package com.hexinfo.dmpro.sparing.controller;

import com.hexinfo.dmpro.common.annotation.AnonymousAccess;
import com.hexinfo.dmpro.sparing.service.WarnService;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;


@RestController
@AllArgsConstructor
@RequestMapping("/api/warn" )
public class WarnController {

    private final WarnService warnService;

    /**
     * 全部源执行情况告警
     */
    @ApiOperation(value = "全部源执行情况告警", notes = "全部源执行情况告警")
    @GetMapping("/warnAllSourceState" )
    @AnonymousAccess
    public ResponseEntity<Object> warnAllSourceState() {
        return ResponseEntity.ok(warnService.warnAllSourceState());
    }

    /**
     * 全部源执行情况告警
     */
    @ApiOperation(value = "失败源执行情况告警", notes = "失败源执行情况告警")
    @GetMapping("/warnSourceFail" )
    @AnonymousAccess
    public ResponseEntity<Object> warnSourceFail(String id) {
        return ResponseEntity.ok(warnService.warnSourceFail(id));
    }

}
